GetSaveFolderItem Function

Used to present the standard Save As dialog box to the user.

Syntax

result = GetSaveFolderItem( filter, default file name )


Parameters

filter

String

The file type to be assigned to the file, as defined in the File Type Sets Editor or via the FileType class.

default file name

String

The name that should appear by default in the Save As dialog box.



Notes

The GetSaveFolderItem function displays the standard Save As file dialog box, allowing the user to choose a location and enter a name for the file to be saved. The SaveAsDialog class provides the same functionality but allows for customization.

The GetSaveFolderItem function does not create the file. It simply returns a FolderItem that represents the potential file. To create the actual file, you will need to call the CreateBinaryFile or CreateTextfile method for the FolderItem.

The filter should either be an empty string or the name of a file type as defined in the File Type Sets Editor or via the FileType class.

On Mac OS X, a Hide Filename Extension checkbox appears in the save-file dialog. The FolderItem returned has its ExtensionVisible property set according to the user's use of this checkbox.


Examples

This example displays the save as file dialog box. A text file is then created and the text properties of three EditFields are written to the new file. Finally the file is closed.

Dim file As FolderItem
Dim fileStream as TextOutputStream
file=GetSaveFolderItem ("","My Info")
If file<> Nil then
 fileStream=file.CreateTextFile
 fileStream.WriteLine namefield.text
 fileStream.WriteLine addressfield.text
 fileStream.WriteLine phonefield.text
 fileStream.Close
end if

See Also

GetOpenFolderItem, SelectFolder functions; FileType, FolderItem, FolderItemDialog, SaveAsDialog classes.